package com.levy.contronller.javase.designModel.proxy;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * Created by levy on 2018/7/18.
 */
public class ProxyHander implements InvocationHandler {

    private RealSubject realSubject;

    public void setRealSubject(RealSubject realSubject) {
        this.realSubject = realSubject;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {

        dazhe();
        Object invoke = method.invoke(realSubject, args);
        return invoke;
    }

    public void dazhe(){
        System.out.println("dazhe");
    }
}
